import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberUserRefundVO, MemberUserRefundForm, MemberUserRefundQuery } from '@/api/member/memberUserRefund/types';

/**
 * 查询用户退款流水列表
 * @param query
 * @returns {*}
 */

export const listMemberUserRefund = (query?: MemberUserRefundQuery): AxiosPromise<MemberUserRefundVO[]> => {
  return request({
    url: '/member/memberUserRefund/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户退款流水详细
 * @param refundId
 */
export const getMemberUserRefund = (refundId: string | number): AxiosPromise<MemberUserRefundVO> => {
  return request({
    url: '/member/memberUserRefund/' + refundId,
    method: 'get'
  });
};

/**
 * 新增用户退款流水
 * @param data
 */
export const addMemberUserRefund = (data: MemberUserRefundForm) => {
  return request({
    url: '/member/memberUserRefund',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户退款流水
 * @param data
 */
export const updateMemberUserRefund = (data: MemberUserRefundForm) => {
  return request({
    url: '/member/memberUserRefund',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户退款流水
 * @param refundId
 */
export const delMemberUserRefund = (refundId: string | number | Array<string | number>) => {
  return request({
    url: '/member/memberUserRefund/' + refundId,
    method: 'delete'
  });
};
